package com.heima.user.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户审核
 *
 * @author 朱安东
 * @version 1.0
 * @project leadnews-project
 * @date 2024/1/26 11:16:31
 */
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {
    @Autowired
    private ApUserRealnameService apUserRealnameService;

    /**
     * 按状态查询页面
     *
     * @param authDto 身份验证 DTO
     * @return {@link ResponseResult}
     */
    @PostMapping("/list")
    public ResponseResult PageQueryByStatus(@RequestBody AuthDto authDto) {
        return apUserRealnameService.PageQueryByStatus(authDto);
    }

    /**
     * 身份验证通行证
     *
     * @param authDto 身份验证 DTO
     * @return {@link ResponseResult}
     */
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto authDto) {
        return apUserRealnameService.updateStatus(authDto);
    }

    /**
     * 身份验证失败
     *
     * @param authDto 身份验证 DTO
     * @return {@link ResponseResult}
     */
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto authDto) {
        return apUserRealnameService.updateStatus(authDto);
    }
}
